@echo off

set curpath=%~dp0

SETLOCAL
set CFG_FILE=env.cfg
set c_path = %CFG_FILE%
IF NOT [%1]==[] set CFG_FILE=%1
echo Using config %c_path% %CFG_FILE%
IF EXIST %c_path% FOR /F "delims=" %%A IN (%c_path%) DO SET "%%A"
ENDLOCAL

call "%VS_VAR_DIR%"

set QTDIR=%QT_ROOT%\%QT_VERSION%\%QT_ARCH%\

call %QTDIR%\bin\qtenv2.bat

set PATH= %QTDIR%\bin;%CMAKE_BIN%;%BOOST_DIR%;%BOOST_DIR%\lib_shared;%PATH%;

set EXTERNALS_ROOT=%curpath%..\Externals\
set EXTERNALS_BIN=%EXTERNALS_ROOT%bin\
set EXTERNALS_LIB=%EXTERNALS_ROOT%lib\
set EXTERNALS_INCLUDE=%EXTERNALS_ROOT%include

set OPL_ROOT=%curpath%..\Opl\
set OPL_INCLUDE=%OPL_ROOT%
set OPL_LIB=%OPL_ROOT%lib

rem if exist n:\bin\path.bat call n:\bin\path.bat

rem set QML_IMPORT_PATH=%QML_IMPORT_PATH%;c:\home\src\optra\client\engine\extensions\

echo Boost dir=%BOOST_DIR%
echo VS vars dir=%VS_VAR_DIR%
echo CMake bin=%CMAKE_BIN%
echo QT Arch=%QTDIR%

echo Script directory=%curpath%
echo Externals=%EXTERNALS_ROOT%
echo Externals bin=%EXTERNALS_BIN%
echo Externals lib=%EXTERNALS_LIB%
echo Externals include=%EXTERNALS_INCLUDE%

echo Opl=%OPL_ROOT%
echo Opl include=%OPL_INCLUDE%
echo Opl lib=%OPL_LIB%

rem call %OPL_ROOT%opl.bat
start /b %QT_ROOT%\Tools\QtCreator\bin\qtcreator.exe
cd %curpath%\..